package com.zsy._21生产者与消费者问题;

/**
 * @author zhangshuaiyin
 * @date 2022/6/12 11:48
 */
public class ProfilerUtils {
    private static final ThreadLocal<Long> TIME_THREAD_LOCAL = ThreadLocal.withInitial(System::currentTimeMillis);

    public static void begin() {
        TIME_THREAD_LOCAL.set(System.currentTimeMillis());
    }

    public static long end() {
        return System.currentTimeMillis() - TIME_THREAD_LOCAL.get();
    }
}
